/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.Date;
import java.util.List;
import queenb.net.entitybean.N500;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.web.util.PackageContants;
import java.sql.SQLException;

/**
 *
 * @author Nguyen Hung
 */
public class N500Store extends N500 {

    public int updateN500(int pnFH000, int pnFH200, int pnFN100, int pnFC250, int pnFN000, Date pdND501, String pvNV502, String pvNV503, String pvNV504, Date pdND505,int pnNN509,int pnNN510,int pnNN511,int pnNN512,int pnNN513, String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_N500, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.INTEGER, pnFC250),
                        new Param(OracleTypes.INTEGER, pnFN000),
                        new Param(OracleTypes.DATE, pdND501),
                        new Param(OracleTypes.CHAR, pvNV502),
                        new Param(OracleTypes.CHAR, pvNV503),
                        new Param(OracleTypes.CHAR, pvNV504),
                        new Param(OracleTypes.DATE, pdND505),
                          new Param(OracleTypes.INTEGER, pnNN509),
                            new Param(OracleTypes.INTEGER, pnNN510),
                              new Param(OracleTypes.INTEGER, pnNN511),
                                new Param(OracleTypes.INTEGER,pnNN512),
                                  new Param(OracleTypes.INTEGER,pnNN513),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, N500.class);
        } catch (SQLException ex) {
            Logger.getLogger(N500Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }

    public List<N500> LISTOFTABN500M(int pnFH000, int pnFH200, int pnFN850, int pnFN100,
            int pnFN000, Date pdND501F,Date pdND501T,int pnNN509, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_N500M, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN850),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.INTEGER, pnFN000),
                        new Param(OracleTypes.DATE, pdND501F),
                        new Param(OracleTypes.DATE, pdND501T),
                        new Param(OracleTypes.INTEGER, pnNN509),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, N500.class);
        } catch (SQLException ex) {
            Logger.getLogger(N500Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N500Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N500Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public List<N500> LISTOFTABN500(int pnFH000, int pnFH200, int pnFN100,
            int pnFN000, Date pdND501, Date pdND505, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_N500, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFN100),
                        new Param(OracleTypes.INTEGER, pnFN000),
                        new Param(OracleTypes.DATE, pdND501),
                        new Param(OracleTypes.DATE, pdND505),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, N500.class);
        } catch (SQLException ex) {
            Logger.getLogger(N500Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N500Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N500Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
     public int deleteN500(int pnPN000,int pnPN100, String pvLOGIN) {
         DataStatement dataStatement = new DataStatement(PackageContants.DELETE_N500, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPN000),
                     new Param(OracleTypes.INTEGER, pnPN100),
                    new Param(OracleTypes.CHAR, pvLOGIN)});
        try {
            return super.update(dataStatement, N500.class);
        } catch (SQLException ex) {
            Logger.getLogger(N500Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }
     // danh sach nhan vien nghi phep
     
    public List<N500> getNCURPKS_LISTOFTABN500HOLI(int pnFH000, int pnFH200, String pvLOGIN) {
        //throw new UnsupportedOperationException("Not supported yet.");
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_EMP_HOLI, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),          
                   //     new Param(OracleTypes.CHAR, keysrearch),                    
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, N500.class);
        } catch (SQLException ex) {
            Logger.getLogger(EmployeeStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(EmployeeStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(EmployeeStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    // public List<N100> getNCURPKS_LISTOFTABN500HOLI(int pnFH000, int pnFH200, String pvLOGIN);
}
